<?php
namespace Admin\Controller;
// 套餐模板
class TaocanController extends CommonController {

    public function outxls(){

	   $filename='套餐列表';
       $map=$this->_search();
       
       if($_REQUEST ['ids']!='all'){
       	 $map['id'] = array('in', explode(',', $_REQUEST ['ids']));
       }
        $volist = D('Taocan')->where($map)->field('name,content,yunying_id,create_time')->select();

       foreach ($volist as $key =>$vo){
           $yunying = D('Yunying')->find($vo['yunying_id']);
           $volist[$key]['yunying_id']= $yunying['name'];
			$volist[$key]['create_time']=date("Y-m-d",$vo['create_time']);
		}
		
		$headArr=array("套餐名称","套餐描述",'运营商',"创建日期");
    
		$this->xlsout($filename,$headArr,$volist);
        
		
    }

	public function add(){
		$admin_id = $_SESSION['zs_admin']['userid'];
		if ($admin_id == 1) {
			$dengji = 2;
		}else{
			$user = M('user')->where(array('id'=>$admin_id))->find();//当前用户
			if ($user['dengji'] == 2) {
				$dengji = 3;
			}
			if ($user['dengji'] == 3) {
				$dengji = 4;
			}
		}

		$this->assign('dengji',$dengji);
		$this->assign('admin_id',$admin_id);
		$this->display();
	}
	function edit() {
        $model = M('Taocan');
		$id = $_REQUEST [$model->getPk()];
		$vo = $model->getById($id);
		$this->assign('vo', $vo);
		$this->display();
	}



}

?>